<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ConsultativeTypeManage.aspx.cs"
    Inherits="admin_Consultative_ConsultativeTypeManage" %>

<%@ Register Src="../../Control/PageNo.ascx" TagName="PageNo" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>资讯分类管理</title>
<link rel="stylesheet" href="../skin/style.css" type="text/css" />
<script type="text/javascript" src="../../js/jquery.js"></script>
    <script type="text/javascript">
         function checkinfo()
         {
            if(document.getElementById("txtName").value=="")
            {
               document.getElementById("name").innerHTML="分类名称不能为空";
              return false; 
            }
         }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="itemtitle">
            <h3>
                资讯分类管理</h3>
        </div>
		<div class="itemtitle_tect">
            <ul>
                <li>通过资讯分类管理，您可以进行编辑分类、修改和删除等操作；</li>
            </ul>
        </div>
        <div class="clr">
        </div>
        <asp:Panel ID="plConsultativeType" runat="server" Visible="false">
            <div class="itemtitle">
                <h3>
                    添加分类</h3>
            </div>
            <div class="itemtitle_tect">
                <p>
                    分类名称：
                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                    <asp:Button ID="btnSave" runat="server" Text="添加" CssClass="i_button" OnClientClick="javascript: return checkinfo()" OnClick="btnSave_Click" />
                    <asp:Button ID="btnCancel" runat="server" CssClass="i_button" Text="取消" OnClick="btnCancel_Click" />
                </p>
              <div id="name" style="color:Red; text-align:center;"></div>
            </div>
        </asp:Panel>
         <asp:Panel ID="plMove" runat="server" Visible="false">
            <div class="itemtitle_tect">
                <p>
                    请选择分类名称：
                    <asp:DropDownList ID="ddlMove" runat="server">
                    </asp:DropDownList>
                    <asp:Button ID="btnMove" runat="server" Text="转移" CssClass="i_button"  OnClientClick="javascript: return check()" OnClick="btnMove_Click" />
                    <asp:Button ID="btnBank" runat="server" CssClass="i_button" Text="取消" OnClick="btnBank_Click"  />
                </p>
            </div>
        </asp:Panel> 
        <div class="clr">
        </div>
        <div class="partition">
            <div class="Option">
                <span><strong>快捷操作</strong></span> <span>
                    <asp:LinkButton ID="ButJS" runat="server" OnClick="ButJS_Click">更新分类</asp:LinkButton>
                </span><span>
                    <asp:LinkButton runat="server" ID="Lbtn_Add" OnClick="Lbtn_Add_Click">添加分类</asp:LinkButton></span>
            </div>
        </div>
        <div class="clr">
        </div>
        <div class="talbe_border">
            <asp:GridView runat="server" ID="gvConsultativeType" CellPadding="0" GridLines="None" HeaderStyle-CssClass="itemtitle"
                CssClass="talbe_list" AutoGenerateColumns="False" OnRowDeleting="gvConsultativeType_RowDeleting"
                OnRowCreated="gvConsultativeType_RowCreated" DataKeyNames="ID" OnRowCancelingEdit="gvConsultativeType_RowCancelingEdit"
                OnRowEditing="gvConsultativeType_RowEditing" OnRowUpdating="gvConsultativeType_RowUpdating" OnRowDataBound="gvConsultativeType_RowDataBound">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </ItemTemplate>
                        <HeaderStyle CssClass="th20 tou" />
                        <ItemStyle CssClass="nolet" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="分类名称">
                        <ItemTemplate>
                            <asp:HyperLink ID="TypeName" runat="server" NavigateUrl='<%# Eval("ID", "ConsultativeTypeManage.aspx?ParentID={0}") %>'><%# Eval("Name") %></asp:HyperLink>
                            <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' Visible="false" ></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemStyle CssClass="left2" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作选项">
                        <EditItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                                Text="更新"></asp:LinkButton>
                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                Text="取消"></asp:LinkButton>
                        </EditItemTemplate>
                        <ItemTemplate>
                             <asp:HyperLink ID="hlkAdd" runat="server" NavigateUrl='<%# Eval("ID", "ConsultativeTypeManage.aspx?ParentID={0}") %>'> 添加子分类</asp:HyperLink>
                                
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="编辑"></asp:LinkButton>
                            <asp:LinkButton ID="lbtnDelete" Style="text-decoration: none" runat="server" Text="删除" 
                                OnClientClick="return confirm('删除此类别,该类别的所有信息将全部删除,点右边转移按钮可以将信息转移其它类别,你确定要删除吗?')"
                                CommandName="delete">
                            </asp:LinkButton>
                            <asp:LinkButton ID="lbtnMove" Style="text-decoration: none" runat="server" Text="转移" OnClick="lbtnMove_Click" OnCommand="lbtnMove_Command" CommandArgument='<%# Eval("ID") %>'>
                            </asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle CssClass="th180" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="header" />
            </asp:GridView>
            <div class="Paging">
                <p>
                    <uc1:PageNo ID="PageNo1" runat="server" />
                </p>
                <input id="CheckBox2" name="CheckBox2" onclick="SelectAll();" type="checkbox" />全选
                <asp:Button ID="btnDelete" runat="server" Font-Size="9pt" Text="批量删除" CssClass="i_button" OnClick="btnDelete_Click" />
                <asp:Label ID="lblMessage" runat="server" Visible="false"></asp:Label>
            </div>
        </div>
    </form>
</body>
</html>
